﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Protegidos/Pessoas/GENTE_PesDt.master" AutoEventWireup="true" CodeFile="pAtestados.aspx.cs" Inherits="Protegidos_Pessoas_DadosPessoa_pAtestados" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphSubConteudo" Runat="Server">

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">

    //Atestados
    function ShowInsertAtestados() {
        window.radopen("_popup/ppAtestados.aspx", "RadWindow1");
        return false;
    }
    function ShowUpdatetAtestados(id) {
        window.radopen("_popup/ppAtestados.aspx?Id=" + id, "RadWindow1");
        //return false;
    }

    //CAT
    function ShowInsertCAT() {
        window.radopen("_popup/ppCAT.aspx", "RadWindow1");
        return false;
    }
    function ShowUpdateCAT(id) {
        window.radopen("_popup/ppCAT.aspx?Id=" + id, "RadWindow1");
        //return false;
    }

    function refreshGrid(arg) {
        $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("arg");
    }
    
</script>
</telerik:RadCodeBlock>

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
<AjaxSettings>
    <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="gridAtestados" LoadingPanelID="RadAjaxLoadingPanel1" />
        </UpdatedControls>
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="gridCAT" LoadingPanelID="RadAjaxLoadingPanel1" />
        </UpdatedControls>
    </telerik:AjaxSetting>      
    <telerik:AjaxSetting AjaxControlID="gridAtestados">
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="gridAtestados" LoadingPanelID="RadAjaxLoadingPanel1" />
        </UpdatedControls>
    </telerik:AjaxSetting>                                                             
    <telerik:AjaxSetting AjaxControlID="gridCAT">
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="gridCAT" LoadingPanelID="RadAjaxLoadingPanel1" />
        </UpdatedControls>
    </telerik:AjaxSetting>                                                             
</AjaxSettings>
</telerik:RadAjaxManager>

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Telerik" >
</telerik:RadAjaxLoadingPanel> 

<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
    <Windows>
        <telerik:RadWindow  ID="RadWindow1" runat="server" Height="400px" Width="500px" ReloadOnShow="true" Modal="true"
            ShowContentDuringLoad="false" VisibleStatusbar="false" Behaviors="Close, Move, Resize, Maximize" />
        <telerik:RadWindow  ID="RadWindow2" runat="server" Height="400px" Width="500px" ReloadOnShow="true" Modal="true"
            ShowContentDuringLoad="false" VisibleStatusbar="false" Behaviors="Close, Move, Resize, Maximize" />
        <telerik:RadWindow  ID="rwMsg" runat="server" Height="100px" Width="400px" ReloadOnShow="true" Modal="true"
            ShowContentDuringLoad="false" VisibleStatusbar="false" Behaviors="Close, Move, Resize, Maximize" />    
    </Windows>
</telerik:RadWindowManager>

<table width="99%" align="center">
    <tr>
        <td>
            <div class="Titulo01">Atestados</div>
            <div class="Titulo02">Pessoas</div>
        </td>    
    </tr>
    <tr>
        <td>
        
            <table width="100%" class="textoCZ_12B" align="right">
                <tr>
                    <td>
                        <div class="subTitulo_pagina">Atestados</div>
                        <div class="espaco"></div>
                    </td>
                </tr>
                <tr>
                    <td>
                    
                    <%--INICIO - Atestados--%>
                    <telerik:RadGrid ID="gridAtestados" runat="server" AllowPaging="True" Width="100%" Skin="Telerik"
                            OnNeedDataSource="gridAtestados_NeedDataSource"
                            OnDeleteCommand="gridAtestados_DeleteCommand" >
                            <PagerStyle Mode="NumericPages" />
                            <MasterTableView AutoGenerateColumns="False" DataKeyNames="IdAtestado" ClientDataKeyNames="IdAtestado" Width="100%" CommandItemDisplay="Top" PageSize="10">
                                <Columns>
                                    
                                    <telerik:GridBoundColumn UniqueName="Tipo" HeaderText="Tipo" DataField="TipoAtestado.Descricao" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"></telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="Data" HeaderText="Em" DataField="PeriodoInicial" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"></telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="Observacoes" HeaderText="Observações" DataField="Observacoes" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"></telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="GerouAfastamento" HeaderText="Gerou Afastamento" DataField="GerouAfastamento" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"></telerik:GridBoundColumn>
                                    
                                    <telerik:GridHyperLinkColumn DataTextFormatString="Vizualizar"
                                        DataNavigateUrlFields="Path" UniqueName="Path" DataNavigateUrlFormatString="http://localhost/gentev1/arq/{0}" Target="_blank"
                                        HeaderText="Imagem" DataTextField="Path">
                                    </telerik:GridHyperLinkColumn>
                                    <telerik:GridHyperLinkColumn DataTextFormatString="Editar" HeaderStyle-Width="60px"
                                        DataNavigateUrlFields="IdAtestado" UniqueName="IdAtestado" DataNavigateUrlFormatString="javascript: ShowUpdatetAtestados({0})"
                                        DataTextField="IdAtestado">
                                    </telerik:GridHyperLinkColumn>
                                    <telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Remover" CommandName="Delete" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="60px"></telerik:GridButtonColumn>
                                    
                                </Columns>
                                <CommandItemTemplate>
                                    <!-- -->
                                    <table border="0" style="width: 100%;" class="rgCommandTable">
                                        <tbody>
                                            <tr>
                                                <td align="left">
                                                    <input class="rgAdd" type="button" title=" Adicionar Atestados" onclick="return ShowInsertAtestados();" />
                                                    <a href="#" onclick="return ShowInsertAtestados();">Adicionar Atestados</a>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                    <!-- -->
                                </CommandItemTemplate>
                            </MasterTableView>
                        </telerik:RadGrid>
                    <%--FIM - Atestados--%>
                    
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="subTitulo_pagina">CAT - Comunicação de Acidente do Trabalho</div>
                        <div class="espaco"></div>
                    </td>
                </tr>
                <tr>
                    <td>
                    
                    <%--INICIO - CAT--%>
                    <telerik:RadGrid ID="gridCAT" runat="server" AllowPaging="True" Width="100%" Skin="Telerik"
                            OnNeedDataSource="gridCAT_NeedDataSource"
                            OnDeleteCommand="gridCAT_DeleteCommand" >
                            <PagerStyle Mode="NumericPages" />
                            <MasterTableView AutoGenerateColumns="False" DataKeyNames="IdCAT" ClientDataKeyNames="IdCAT" Width="100%" CommandItemDisplay="Top" PageSize="10">
                                <Columns>
                                    
                                    <telerik:GridBoundColumn UniqueName="DataEmissao" HeaderText="Data Emissão" DataField="DataEmissao" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"></telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="DataAcidente" HeaderText="Data Acidente" DataField="DataAcidente" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"></telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="DataAcidente" HeaderText="Hora Acidente" DataField="DataAcidente" DataFormatString="{0:HH:mm}" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"></telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="GerouAfastamento" HeaderText="Gerou Afastamento" DataField="GerouAfastamento" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"></telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="Local" HeaderText="Local" DataField="Local" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"></telerik:GridBoundColumn>
                                    
                                    <telerik:GridHyperLinkColumn DataTextFormatString="Vizualizar"
                                        DataNavigateUrlFields="Path" UniqueName="Path" DataNavigateUrlFormatString="http://localhost/gentev1/arq/{0}" Target="_blank"
                                        HeaderText="Imagem" DataTextField="Path">
                                    </telerik:GridHyperLinkColumn>
                                    <telerik:GridHyperLinkColumn DataTextFormatString="Editar" HeaderStyle-Width="60px"
                                        DataNavigateUrlFields="IdCAT" UniqueName="IdCAT" DataNavigateUrlFormatString="javascript: ShowUpdateCAT({0})"
                                        DataTextField="IdCAT">
                                    </telerik:GridHyperLinkColumn>
                                    <telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Remover" CommandName="Delete" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="60px"></telerik:GridButtonColumn>
                                    
                                </Columns>
                                <CommandItemTemplate>
                                    <!-- -->
                                    <table border="0" style="width: 100%;" class="rgCommandTable">
                                        <tbody>
                                            <tr>
                                                <td align="left">
                                                    <input class="rgAdd" type="button" title=" Adicionar CAT" onclick="return ShowInsertCAT();" />
                                                    <a href="#" onclick="return ShowInsertCAT();">Adicionar CAT</a>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                    <!-- -->
                                </CommandItemTemplate>
                            </MasterTableView>
                        </telerik:RadGrid>
                    <%--FIM - CAT--%>
                    
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>

</asp:Content>

